#ifndef DECODE_H
#define DECODE_H
#include <vector>
#include <map>
#include "common.h"

std::vector<bool> read_jpg(std::string filename, int &fileSize);
void decoder_codebook(std::map<std::vector<bool>, int> &dc_codebook, std::map<std::vector<bool>, std::pair<int,int> > &ac_codebook);
int binaryToBase10(int n);
void huffmanDC(std::map<std::vector<bool>, int> &dc_codebook, std::vector<bool> &rawData, std::vector<int> &intBuffer, int &index, int &previousDC);
void huffmanAC(std::map<std::vector<bool>, std::pair<int, int> > &ac_codebook, std::vector<bool> &rawData, std::vector<int> &intBuffer, int &index);
int **scan(std::vector<int> &intBuffer);
float **deQuantize(int **matrix8x8, int quantize_matrix[BLK_DIM][BLK_DIM], float qs);
float *convertImg(std::vector<std::vector<float> > processedBuffer, int dim);
void writeFile(int dim, std::string outputFile, float *img);
int decode(float qs);


#endif
